<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Sonos API</title>
    <style media="screen">
      body { color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; margin-top: 25px;}
      h1 { text-align: center; }
      a { color: #333333; text-decoration: none; }
      a:hover { text-decoration: underline; }
      .logo { display: block; margin: auto }
      .content { margin: 20px 25%; }
      .docs { background-color: #f4f4f4; border-radius: 4px; padding: 10px; margin-bottom: 20px;}
      .docs p, .docs li { padding: 0; margin: 0; line-height: 28px; font-size: 14px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; }
      .docs .method { background-color: #dbdbdb; padding: 4px; border-radius: 2px; margin-right: 4px;}
      .docs h2 { margin-bottom: 8px;}
      .docs h2:first-child { margin-top: 0;}
      .docs h4 { margin-left: 10px; }
      .docs ul { list-style-type: none; padding-left: 20px; }
      .docs .explanation { margin-left: 20px; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 14px; }
      .docs .experimental { background-color: red; border-radius: 3px; color: white; font-size: 10px; line-height: 12px; padding: 2px 6px; font-weight: bold; }
      .footer { text-align: center; font-size: 12px; margin: 10px 0 50px 0;}
    </style>
  </head>
  <body>
    <img class="logo" src="/sonos-icon.png" alt="Sonos" width="256px" />
    <div class="content">
      <h1>Sonos API</h1>

      <div class="docs">
        <h2>Info</h2>
        <p><span class="method">GET</span> <a href="/zones">/zones</a></p>
        <p><span class="method">GET</span> <a href="/favorites">/favorites</a></p>
        <p><span class="method">GET</span> <a href="/playlists">/playlists</a></p>
      </div>

      <div class="docs">
        <h2>Global Control</h2>
        <p><span class="method">GET</span> /lockvolumes</p>
        <p><span class="method">GET</span> /unlockvolumes</p>
        <p><span class="method">GET</span> /pauseall/{timeout in minutes (optional)}</p>
        <p><span class="method">GET</span> /resumeall/{timeout in minutes (optional)}</p>
        <p><span class="method">GET</span> /reindex</p>
        <p><span class="method">GET</span> /sleep/{timeout in seconds or timestamp HH:MM:SS or off}</p>
        <p><span class="method">GET</span> /preset/{JSON preset}</p>
        <p><span class="method">GET</span> /preset/{predefined preset name}</p>
      </div>

      <div class="docs">
        <h2>Zone Control</h2>
        <p><span class="method">GET</span> /{zone name}/{action}[/{parameter}]</p>

        <h3>Actions</h3>

        <h4>Playback</h4>
        <ul>
          <li>play</li>
          <li>pause</li>
          <li>playpause <span class="explanation">toggles playing state</span></li>
          <li>trackseek/{seconds into song, i.e. 60 for 1:00, 120 for 2:00 etc.}</li>
          <li>next</li>
          <li>previous</li>
        </ul>

        <h4>Volume</h4>
        <ul>
          <li>volume/{absolute volume}</li>
          <li>volume/{+ or -}{relative volume}</li>
          <li>groupVolume/{absolute volume}</li>
          <li>groupVolume/{+ or -}{relative volume}</li>
          <li>mute</li>
          <li>unmute</li>
          <li>groupMute</li>
          <li>groupUnmute</li>
          <li>togglemute</li>
          <li>lockvolumes</li>
          <li>unlockvolumes <span class="explanation"><span class="experimental">experimental</span> enforce the volume that was selected when locking!</span></li>
        </ul>

        <h4>Playback Settings</h4>
        <ul>
          <li>favorite</li>
          <li>playlist</li>
          <li>repeat/{on | off}</li>
          <li>shuffle/{on | off}</li>
          <li>crossfade/{on | off}</li>
        </ul>

        <h4>Queue</h4>
        <ul>
          <li>queue</li>
          <li>clearqueue</li>
          <li>seek/{queue index}</li>
        </ul>

        <h4>Room Grouping</h4>
        <ul>
          <li>add/{player name from existing zone, prefix with player you want to join}</li>
          <li>join/{player player to join in, prefix with player from current zone} (this is just the inverse of add)</li>
          <li>isolate</li>
          <li>ungroup (alias of isolate)</li>
          <li>leave (alias of isolate)</li>
        </ul>

        <h4>Other</h4>
        <ul>
          <li>say</li>
        </ul>

        <h4>Internals</h4>
        <ul>
          <li>state <span class="explanation">returns a json-representation of the current state of player</span></li>
        </ul>
      </div>

      <div class="footer">
        <p><a href="/docs">Full documentation</a></p>
        <p>Learn more at <a href="https://github.com/jishi/node-sonos-http-api">https://github.com/jishi/node-sonos-http-api</a></p>
      </div>
    </div>

  </body>
</html>
